package com.apestech.framework.run.modul;

import java.util.Vector;

import com.apestech.framework.run.callback.ThreadCallBackHandler;

/**
 * 同一执行大方法，调用多个不同子过程，每个子过程的入参和方法类名都不同
 * @author hup
 *
 */
public class MutiParam {
	
	public Vector<SingleParam> getParam() {
		return param;
	}

	private String name;
	private Vector<SingleParam> param=new Vector<SingleParam>();
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public void add(ThreadCallBackHandler threadCallBackHandler){
		SingleParam p=new SingleParam();
		p.add(threadCallBackHandler);
		this.param.add(p);
	}
	
	public void add(String name, ThreadCallBackHandler threadCallBackHandler){
		add(threadCallBackHandler);
		this.param.get(this.param.size()-1).setName(name);
	}
	
	public void add(String className, String methodName){
		SingleParam p=new SingleParam();
		p.add(className, methodName);
		this.param.add(p);
	}
	
	public void add(String name, String className, String methodName){
		add(className, methodName);
		this.param.get(this.param.size()-1).setName(name);
	}
	
	public void add(String className, String methodName, Object... params){
		SingleParam p=new SingleParam();
		p.add(className, methodName, params);
		this.param.add(p);
	}
	
	public void add(String name, String className, String methodName, Object... params){
		add(className, methodName, params);
		this.param.get(this.param.size()-1).setName(name);
	}
	
	public int size(){
		return this.param.size();
	}
	
	public Vector<Object> getParam(int index){
		return this.param.get(index).getParam();
	}
	
	public String getClassName(int index){
		return this.param.get(index).getClassName();
	}
	
	public String getMethodName(int index){
		return this.param.get(index).getMethodName();
	}
	
	public String getName(int index){
		return this.param.get(index).getName();
	}
	
	public boolean isCallback(int index){
		return this.param.get(index).isCallback();
	}
	
	public ThreadCallBackHandler getThreadCallBackHandler(int index) {
		return this.param.get(index).getThreadCallBackHandler();
	}

}
